<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>UC-VID-002：字幕管理原型</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/antd@5.12.8/dist/reset.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background-color: #f5f5f5;
            color: #333;
        }
        
        .header {
            background: #fff;
            padding: 16px 24px;
            border-bottom: 1px solid #e8e8e8;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }
        
        .breadcrumb {
            color: #666;
            font-size: 14px;
        }
        
        .breadcrumb a {
            color: #1890ff;
            text-decoration: none;
        }
        
        .main-content {
            padding: 24px;
            max-width: 1400px;
            margin: 0 auto;
        }
        
        .toolbar {
            background: #fff;
            padding: 16px 20px;
            border-radius: 8px;
            margin-bottom: 16px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .toolbar-left {
            display: flex;
            gap: 12px;
            align-items: center;
        }
        
        .toolbar-right {
            display: flex;
            gap: 12px;
            align-items: center;
        }
        
        .btn {
            padding: 8px 16px;
            border: 1px solid;
            border-radius: 6px;
            font-size: 14px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: all 0.3s;
        }
        
        .btn-primary {
            background: #1890ff;
            border-color: #1890ff;
            color: #fff;
        }
        
        .btn-primary:hover {
            background: #40a9ff;
            border-color: #40a9ff;
        }
        
        .btn-default {
            background: #fff;
            border-color: #d9d9d9;
            color: #333;
        }
        
        .btn-default:hover {
            border-color: #1890ff;
            color: #1890ff;
        }
        
        .btn-success {
            background: #52c41a;
            border-color: #52c41a;
            color: #fff;
        }
        
        .btn-success:hover {
            background: #73d13d;
            border-color: #73d13d;
        }
        
        .content-area {
            display: flex;
            gap: 16px;
        }
        
        .video-section {
            flex: 1;
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            overflow: hidden;
        }
        
        .video-player {
            position: relative;
            background: #000;
            height: 400px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .video-placeholder {
            color: #fff;
            text-align: center;
        }
        
        .video-placeholder-icon {
            font-size: 48px;
            margin-bottom: 16px;
            opacity: 0.6;
        }
        
        .video-controls {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: linear-gradient(transparent, rgba(0,0,0,0.8));
            padding: 20px;
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .play-btn {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: #1890ff;
            border: none;
            color: #fff;
            font-size: 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .progress-bar {
            flex: 1;
            height: 4px;
            background: rgba(255,255,255,0.3);
            border-radius: 2px;
            position: relative;
            cursor: pointer;
        }
        
        .progress-fill {
            height: 100%;
            background: #1890ff;
            border-radius: 2px;
            width: 30%;
        }
        
        .time-display {
            color: #fff;
            font-size: 12px;
            white-space: nowrap;
            font-family: monospace;
        }
        
        .subtitle-panel {
            padding: 20px;
        }
        
        .subtitle-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }
        
        .subtitle-title {
            font-size: 16px;
            font-weight: 600;
            color: #333;
        }
        
        .subtitle-controls {
            display: flex;
            gap: 8px;
        }
        
        .subtitle-btn {
            padding: 6px 12px;
            border: 1px solid #d9d9d9;
            background: #fff;
            border-radius: 4px;
            font-size: 12px;
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .subtitle-btn.active {
            background: #1890ff;
            border-color: #1890ff;
            color: #fff;
        }
        
        .subtitle-list {
            max-height: 300px;
            overflow-y: auto;
            border: 1px solid #e8e8e8;
            border-radius: 6px;
        }
        
        .subtitle-item {
            padding: 12px 16px;
            border-bottom: 1px solid #f0f0f0;
            cursor: pointer;
            transition: background-color 0.3s;
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .subtitle-item:hover {
            background: #f8f9fa;
        }
        
        .subtitle-item.active {
            background: #e6f7ff;
            border-left: 3px solid #1890ff;
        }
        
        .subtitle-time {
            font-size: 12px;
            color: #666;
            font-family: monospace;
            min-width: 80px;
        }
        
        .subtitle-text {
            flex: 1;
            font-size: 14px;
            line-height: 1.5;
        }
        
        .subtitle-actions {
            display: flex;
            gap: 4px;
        }
        
        .action-btn {
            padding: 4px 8px;
            border: 1px solid #d9d9d9;
            background: #fff;
            border-radius: 3px;
            font-size: 11px;
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .action-btn:hover {
            border-color: #1890ff;
            color: #1890ff;
        }
        
        .action-btn.danger:hover {
            border-color: #ff4d4f;
            color: #ff4d4f;
        }
        
        .sidebar {
            width: 350px;
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            padding: 20px;
        }
        
        .sidebar-section {
            margin-bottom: 24px;
        }
        
        .sidebar-title {
            font-size: 14px;
            font-weight: 600;
            color: #333;
            margin-bottom: 12px;
        }
        
        .language-tabs {
            display: flex;
            border-bottom: 1px solid #e8e8e8;
            margin-bottom: 16px;
        }
        
        .language-tab {
            flex: 1;
            padding: 8px 12px;
            text-align: center;
            cursor: pointer;
            border-bottom: 2px solid transparent;
            transition: all 0.3s;
            font-size: 12px;
        }
        
        .language-tab.active {
            color: #1890ff;
            border-bottom-color: #1890ff;
            background: #f0f8ff;
        }
        
        .subtitle-stats {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            margin-bottom: 16px;
        }
        
        .stat-item {
            text-align: center;
            padding: 12px;
            background: #f8f9fa;
            border-radius: 6px;
        }
        
        .stat-value {
            font-size: 18px;
            font-weight: 600;
            color: #1890ff;
            margin-bottom: 4px;
        }
        
        .stat-label {
            font-size: 11px;
            color: #666;
        }
        
        .subtitle-upload {
            border: 2px dashed #d9d9d9;
            border-radius: 6px;
            padding: 20px;
            text-align: center;
            background: #fafafa;
            transition: border-color 0.3s;
            cursor: pointer;
        }
        
        .subtitle-upload:hover {
            border-color: #1890ff;
        }
        
        .upload-icon {
            font-size: 32px;
            color: #d9d9d9;
            margin-bottom: 8px;
        }
        
        .upload-text {
            font-size: 12px;
            color: #666;
            margin-bottom: 4px;
        }
        
        .upload-hint {
            font-size: 10px;
            color: #999;
        }
        
        .subtitle-settings {
            margin-top: 16px;
        }
        
        .setting-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 0;
            border-bottom: 1px solid #f0f0f0;
        }
        
        .setting-item:last-child {
            border-bottom: none;
        }
        
        .setting-label {
            font-size: 12px;
            color: #333;
        }
        
        .setting-control {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .setting-control input[type="checkbox"] {
            margin: 0;
        }
        
        .setting-control select {
            padding: 4px 8px;
            border: 1px solid #d9d9d9;
            border-radius: 4px;
            font-size: 11px;
        }
        
        .modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.5);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }
        
        .modal-content {
            background: #fff;
            border-radius: 8px;
            padding: 24px;
            max-width: 600px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
        }
        
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }
        
        .modal-title {
            font-size: 18px;
            font-weight: 600;
            color: #333;
        }
        
        .modal-close {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
            color: #999;
        }
        
        .form-item {
            margin-bottom: 16px;
        }
        
        .form-item label {
            display: block;
            font-size: 14px;
            color: #333;
            margin-bottom: 4px;
            font-weight: 500;
        }
        
        .form-item input,
        .form-item textarea {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #d9d9d9;
            border-radius: 6px;
            font-size: 14px;
        }
        
        .form-item input:focus,
        .form-item textarea:focus {
            outline: none;
            border-color: #1890ff;
            box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
        }
        
        .form-item textarea {
            resize: vertical;
            min-height: 80px;
        }
        
        .form-row {
            display: flex;
            gap: 16px;
        }
        
        .form-row .form-item {
            flex: 1;
        }
        
        .modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 12px;
            margin-top: 20px;
        }
        
        .btn-large {
            padding: 10px 20px;
            font-size: 14px;
        }
        
        .empty-state {
            text-align: center;
            padding: 40px 20px;
            color: #999;
        }
        
        .empty-state-icon {
            font-size: 48px;
            margin-bottom: 16px;
            color: #d9d9d9;
        }
        
        @media (max-width: 768px) {
            .content-area {
                flex-direction: column;
            }
            
            .sidebar {
                width: 100%;
            }
            
            .toolbar {
                flex-direction: column;
                gap: 12px;
            }
            
            .toolbar-left,
            .toolbar-right {
                width: 100%;
                justify-content: center;
            }
        }
    </style>
</head>
<body>
    <!-- 页面头部 -->
    <div class="header">
        <div class="breadcrumb">
            <a href="#">首页</a> > <a href="#">课程管理</a> > 字幕管理
        </div>
    </div>

    <!-- 主要内容区域 -->
    <div class="main-content">
        <!-- 工具栏 -->
        <div class="toolbar">
            <div class="toolbar-left">
                <button class="btn btn-primary" onclick="addSubtitle()">➕ 添加字幕</button>
                <button class="btn btn-default" onclick="importSubtitle()">📤 导入字幕</button>
                <button class="btn btn-default" onclick="exportSubtitle()">📥 导出字幕</button>
                <button class="btn btn-success" onclick="autoGenerate()">🤖 自动生成</button>
            </div>
            <div class="toolbar-right">
                <button class="btn btn-default" onclick="previewSubtitle()">👁️ 预览</button>
                <button class="btn btn-default" onclick="syncSubtitle()">🔄 同步</button>
                <button class="btn btn-default" onclick="saveSubtitle()">💾 保存</button>
            </div>
        </div>

        <!-- 内容区域 -->
        <div class="content-area">
            <!-- 视频和字幕区域 -->
            <div class="video-section">
                <div class="video-player">
                    <div class="video-placeholder">
                        <div class="video-placeholder-icon">🎬</div>
                        <div>选择视频文件开始编辑字幕</div>
                    </div>
                    <div class="video-controls">
                        <button class="play-btn" onclick="togglePlay()">▶️</button>
                        <div class="progress-bar" onclick="seekVideo(event)">
                            <div class="progress-fill"></div>
                        </div>
                        <div class="time-display">0:00 / 30:00</div>
                    </div>
                </div>
                
                <div class="subtitle-panel">
                    <div class="subtitle-header">
                        <div class="subtitle-title">字幕列表</div>
                        <div class="subtitle-controls">
                            <button class="subtitle-btn active">中文</button>
                            <button class="subtitle-btn">英文</button>
                            <button class="subtitle-btn">越南语</button>
                        </div>
                    </div>
                    
                    <div class="subtitle-list">
                        <div class="subtitle-item active" onclick="selectSubtitle(this)">
                            <div class="subtitle-time">00:00</div>
                            <div class="subtitle-text">欢迎学习基础操作培训课程</div>
                            <div class="subtitle-actions">
                                <button class="action-btn" onclick="editSubtitle(event, this)">编辑</button>
                                <button class="action-btn" onclick="deleteSubtitle(event, this)">删除</button>
                            </div>
                        </div>
                        <div class="subtitle-item" onclick="selectSubtitle(this)">
                            <div class="subtitle-time">00:05</div>
                            <div class="subtitle-text">在开始操作之前，请确保佩戴安全防护用品</div>
                            <div class="subtitle-actions">
                                <button class="action-btn" onclick="editSubtitle(event, this)">编辑</button>
                                <button class="action-btn" onclick="deleteSubtitle(event, this)">删除</button>
                            </div>
                        </div>
                        <div class="subtitle-item" onclick="selectSubtitle(this)">
                            <div class="subtitle-time">00:12</div>
                            <div class="subtitle-text">检查工作环境是否安全，确认设备状态正常</div>
                            <div class="subtitle-actions">
                                <button class="action-btn" onclick="editSubtitle(event, this)">编辑</button>
                                <button class="action-btn" onclick="deleteSubtitle(event, this)">删除</button>
                            </div>
                        </div>
                        <div class="subtitle-item" onclick="selectSubtitle(this)">
                            <div class="subtitle-time">00:18</div>
                            <div class="subtitle-text">按照标准操作流程开始执行任务</div>
                            <div class="subtitle-actions">
                                <button class="action-btn" onclick="editSubtitle(event, this)">编辑</button>
                                <button class="action-btn" onclick="deleteSubtitle(event, this)">删除</button>
                            </div>
                        </div>
                        <div class="subtitle-item" onclick="selectSubtitle(this)">
                            <div class="subtitle-time">00:25</div>
                            <div class="subtitle-text">注意观察操作过程中的关键节点</div>
                            <div class="subtitle-actions">
                                <button class="action-btn" onclick="editSubtitle(event, this)">编辑</button>
                                <button class="action-btn" onclick="deleteSubtitle(event, this)">删除</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 侧边栏 -->
            <div class="sidebar">
                <div class="sidebar-section">
                    <div class="sidebar-title">语言设置</div>
                    <div class="language-tabs">
                        <div class="language-tab active" onclick="switchLanguage(this, 'zh')">中文</div>
                        <div class="language-tab" onclick="switchLanguage(this, 'en')">英文</div>
                        <div class="language-tab" onclick="switchLanguage(this, 'vi')">越南语</div>
                    </div>
                </div>

                <div class="sidebar-section">
                    <div class="sidebar-title">字幕统计</div>
                    <div class="subtitle-stats">
                        <div class="stat-item">
                            <div class="stat-value">25</div>
                            <div class="stat-label">字幕条数</div>
                        </div>
                        <div class="stat-item">
                            <div class="stat-value">30</div>
                            <div class="stat-label">总时长(分钟)</div>
                        </div>
                    </div>
                </div>

                <div class="sidebar-section">
                    <div class="sidebar-title">字幕上传</div>
                    <div class="subtitle-upload" onclick="uploadSubtitleFile()">
                        <div class="upload-icon">📁</div>
                        <div class="upload-text">点击上传字幕文件</div>
                        <div class="upload-hint">支持 SRT, VTT, ASS 格式</div>
                    </div>
                </div>

                <div class="sidebar-section">
                    <div class="sidebar-title">字幕设置</div>
                    <div class="subtitle-settings">
                        <div class="setting-item">
                            <span class="setting-label">自动同步</span>
                            <div class="setting-control">
                                <input type="checkbox" checked>
                            </div>
                        </div>
                        <div class="setting-item">
                            <span class="setting-label">显示时长</span>
                            <div class="setting-control">
                                <input type="checkbox" checked>
                            </div>
                        </div>
                        <div class="setting-item">
                            <span class="setting-label">字体大小</span>
                            <div class="setting-control">
                                <select>
                                    <option value="small">小</option>
                                    <option value="medium" selected>中</option>
                                    <option value="large">大</option>
                                </select>
                            </div>
                        </div>
                        <div class="setting-item">
                            <span class="setting-label">字幕位置</span>
                            <div class="setting-control">
                                <select>
                                    <option value="bottom">底部</option>
                                    <option value="top">顶部</option>
                                    <option value="center">中间</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 字幕编辑弹窗 -->
    <div class="modal" id="subtitleEditModal">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">编辑字幕</h3>
                <button class="modal-close" onclick="closeModal()">&times;</button>
            </div>
            <div class="modal-body">
                <div class="form-row">
                    <div class="form-item">
                        <label>开始时间</label>
                        <input type="text" value="00:00" placeholder="HH:MM:SS">
                    </div>
                    <div class="form-item">
                        <label>结束时间</label>
                        <input type="text" value="00:05" placeholder="HH:MM:SS">
                    </div>
                </div>
                <div class="form-item">
                    <label>字幕内容</label>
                    <textarea placeholder="请输入字幕内容...">欢迎学习基础操作培训课程</textarea>
                </div>
                <div class="form-row">
                    <div class="form-item">
                        <label>语言</label>
                        <select>
                            <option value="zh" selected>中文</option>
                            <option value="en">英文</option>
                            <option value="vi">越南语</option>
                        </select>
                    </div>
                    <div class="form-item">
                        <label>样式</label>
                        <select>
                            <option value="normal" selected>普通</option>
                            <option value="bold">粗体</option>
                            <option value="italic">斜体</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" onclick="closeModal()">取消</button>
                <button class="btn btn-primary" onclick="saveSubtitleEdit()">保存</button>
            </div>
        </div>
    </div>

    <!-- 字幕导入弹窗 -->
    <div class="modal" id="subtitleImportModal">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">导入字幕</h3>
                <button class="modal-close" onclick="closeModal()">&times;</button>
            </div>
            <div class="modal-body">
                <div class="form-item">
                    <label>选择文件</label>
                    <div class="subtitle-upload" onclick="selectSubtitleFile()">
                        <div class="upload-icon">📁</div>
                        <div class="upload-text">点击选择字幕文件</div>
                        <div class="upload-hint">支持 SRT, VTT, ASS 格式，最大 10MB</div>
                    </div>
                </div>
                <div class="form-item">
                    <label>文件格式</label>
                    <select>
                        <option value="srt" selected>SRT</option>
                        <option value="vtt">VTT</option>
                        <option value="ass">ASS</option>
                        <option value="auto">自动检测</option>
                    </select>
                </div>
                <div class="form-item">
                    <label>语言</label>
                    <select>
                        <option value="zh" selected>中文</option>
                        <option value="en">英文</option>
                        <option value="vi">越南语</option>
                    </select>
                </div>
                <div class="form-item">
                    <label>
                        <input type="checkbox" checked> 覆盖现有字幕
                    </label>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" onclick="closeModal()">取消</button>
                <button class="btn btn-primary" onclick="importSubtitleFile()">导入</button>
            </div>
        </div>
    </div>

    <script>
        // 全局变量
        let currentLanguage = 'zh';
        let selectedSubtitle = null;

        // 播放控制
        function togglePlay() {
            console.log('播放/暂停');
        }

        function seekVideo(event) {
            console.log('跳转到:', event);
        }

        // 字幕管理
        function selectSubtitle(element) {
            document.querySelectorAll('.subtitle-item').forEach(item => {
                item.classList.remove('active');
            });
            element.classList.add('active');
            selectedSubtitle = element;
        }

        function editSubtitle(event, element) {
            event.stopPropagation();
            document.getElementById('subtitleEditModal').style.display = 'flex';
        }

        function deleteSubtitle(event, element) {
            event.stopPropagation();
            if (confirm('确定要删除这条字幕吗？')) {
                element.remove();
            }
        }

        function addSubtitle() {
            document.getElementById('subtitleEditModal').style.display = 'flex';
        }

        function importSubtitle() {
            document.getElementById('subtitleImportModal').style.display = 'flex';
        }

        function exportSubtitle() {
            console.log('导出字幕');
        }

        function autoGenerate() {
            console.log('自动生成字幕');
        }

        function previewSubtitle() {
            console.log('预览字幕');
        }

        function syncSubtitle() {
            console.log('同步字幕');
        }

        function saveSubtitle() {
            console.log('保存字幕');
        }

        // 语言切换
        function switchLanguage(element, language) {
            document.querySelectorAll('.language-tab').forEach(tab => {
                tab.classList.remove('active');
            });
            element.classList.add('active');
            currentLanguage = language;
            console.log('切换到语言:', language);
        }

        // 文件上传
        function uploadSubtitleFile() {
            const input = document.createElement('input');
            input.type = 'file';
            input.accept = '.srt,.vtt,.ass';
            input.onchange = (e) => {
                const file = e.target.files[0];
                if (file) {
                    console.log('上传字幕文件:', file.name);
                }
            };
            input.click();
        }

        function selectSubtitleFile() {
            const input = document.createElement('input');
            input.type = 'file';
            input.accept = '.srt,.vtt,.ass';
            input.onchange = (e) => {
                const file = e.target.files[0];
                if (file) {
                    console.log('选择字幕文件:', file.name);
                }
            };
            input.click();
        }

        function importSubtitleFile() {
            closeModal();
            console.log('导入字幕文件');
        }

        // 保存编辑
        function saveSubtitleEdit() {
            closeModal();
            console.log('保存字幕编辑');
        }

        // 弹窗控制
        function closeModal() {
            document.querySelectorAll('.modal').forEach(modal => {
                modal.style.display = 'none';
            });
        }

        // 点击弹窗外部关闭
        document.querySelectorAll('.modal').forEach(modal => {
            modal.addEventListener('click', (e) => {
                if (e.target === modal) {
                    closeModal();
                }
            });
        });

        // 字幕语言切换
        document.querySelectorAll('.subtitle-btn').forEach(btn => {
            btn.addEventListener('click', () => {
                document.querySelectorAll('.subtitle-btn').forEach(b => {
                    b.classList.remove('active');
                });
                btn.classList.add('active');
                console.log('切换字幕语言:', btn.textContent);
            });
        });

        // 设置变更
        document.querySelectorAll('.setting-control input, .setting-control select').forEach(control => {
            control.addEventListener('change', () => {
                console.log('设置变更:', control.name || control.id, control.value);
            });
        });
    </script>
</body>
</html>

